import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/public/public_date.dart';
import 'package:honeypotflutter/public/views/public_appBar.dart';
import 'package:honeypotflutter/public/views/public_scrollView.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/publicBussine/bussine_font.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_card.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_item.dart';
import '../../model/billing_list.dart';
import 'logic.dart';

class BillingInfoPage extends StatefulWidget {
  const BillingInfoPage({Key? key}) : super(key: key);

  @override
  State<BillingInfoPage> createState() => _BillingInfoPageState();
}

class _BillingInfoPageState extends State<BillingInfoPage> {
  final BillingInfoLogic logic = Get.put(BillingInfoLogic());
  final BillingListModel itemModel = Get.arguments;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: HLAppBar(navigationTitle: "详情"),
      body: HLScrollView(
        children: [
          MGCard(
            margin: EdgeInsets.all(16),
            padding: EdgeInsets.all(25),
            children: [
              Text(
                "金额",
                style: TextStyle(
                  fontSize: MGFont.textFont2,
                  color: MGColors.text3Color,
                ),
              ),
              SizedBox(height: 10),
              Text(
                (itemModel.billTyp == 1) ? "+${itemModel.amount?.toStringAsFixed(2)}" : "-${itemModel.amount?.toStringAsFixed(2)}",
                style: TextStyle(
                  fontSize: MGFont.titleFont1,
                  color: MGColors.text1Color,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ],
          ),
          MGCard(
            margin: EdgeInsets.all(16),
            children: [
              MGItems(
                leadTitle: "金      额:",
                trailingTitle: "${itemModel.amount?.toStringAsFixed(2)}元",
                showBottomSplit: true,
              ),
              MGItems(
                leadTitle: "消费类型:",
                trailingTitle: itemModel.expensesTypeDisplayName,
                showBottomSplit: true,
              ),
              MGItems(leadTitle: "时      间:", trailingTitle: HLDate.hl_formatDate(itemModel.createTime))
            ],
          )
        ],
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<BillingInfoLogic>();
    super.dispose();
  }
}
